//
//  ViewController.m
//  LastOne
//
//  Created by dllo on 15/11/3.
//  Copyright © 2015年 sc. All rights reserved.
//

#import "ViewController.h"
#import "NightHeader.h"
#import "Music.h"
#import "Reachability.h"
@interface ViewController ()
@property(nonatomic, strong)UILabel *label;
@property(nonatomic, strong)UIButton *button;
@property(nonatomic, strong)Reachability *conn;
@end

@implementation ViewController

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:YES];
    [self.navigationController.navigationBar NightWithType:UIViewColorType1];
    [self.tabBarController.tabBar NightWithType:UIViewColorTypeNormal];
    //改变nav字体颜色
    [self.navigationController.navigationBar setTitleTextAttributes:[NSMutableDictionary dictionaryWithObjectsAndKeys:[UIColor whiteColor], NSForegroundColorAttributeName, nil]];
    
    //不透明
    self.navigationController.navigationBar.translucent = NO;
    
    //此法的只有在设置了以下代码才会被调用（对于preferredStatusBarStyle不执行问题）
    [self.navigationController.navigationBar setBarStyle:UIBarStyleBlack];
    self.navigationController.navigationBar.tintColor = [UIColor whiteColor];
    self.tabBarController.tabBar.translucent = NO;
    
    //检测网络状态
 //   [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(checkNetWorkState) name:kReachabilityChangedNotification object:nil];
    
 //   _conn = [Reachability reachabilityForInternetConnection];
    //开始监听
 //   [_conn startNotifier];
 //   [self checkNetWorkState];
    
}
//- (void)checkNetWorkState
//{
//    Reachability *wifi = [Reachability reachabilityForLocalWiFi];
//    Reachability *conn = [Reachability reachabilityForInternetConnection];
//    if ([wifi currentReachabilityStatus] != NotReachable) {
//        NSLog(@"wifi");
//        [_label removeFromSuperview];
//    }
//    else if([conn currentReachabilityStatus] != NotReachable){
//        NSLog(@"2/3/4G网络");
//        [_label removeFromSuperview];
//    }
//    else{
//       // NSLog(@"无网络");
//        [self isNetWork:@"  当前网络不给力"];
//        NSLog(@"fds");
//       
//        
//    }
//    
//}
//- (void)isNetWork:(NSString *)str
//{
//    _label.text = str;
//    _label = [[UILabel alloc] initWithFrame:CGRectMake(0, 500, self.view.frame.size.width, 30)];
//    _label.backgroundColor = [UIColor redColor];
//    _label.textColor = [UIColor whiteColor];
//    _label.text = str;
//    [[UIApplication sharedApplication].windows.lastObject addSubview:_label];
//    
//     //延迟执行
//    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
//        [_label removeFromSuperview];
//    });
//    
//    
//}
- (void)viewDidLoad {
    [super viewDidLoad]; 
}

#pragma mark 改变状态栏的颜色
-(UIStatusBarStyle)preferredStatusBarStyle
{
    return 3;
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
